package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.VariableInstructionBytecodeEvent;

public class VariableInstructionBytecodeEventImpl extends BytecodeEventImpl implements VariableInstructionBytecodeEvent
{
    private int opcode;
    private int localVariableIndex;

    public VariableInstructionBytecodeEventImpl(final int aOpcode, final int aLocalVariableIndex) {
        opcode = aOpcode;
        localVariableIndex = aLocalVariableIndex;
    }

    @Override
    public int getType() {
        return VARIABLE_INSTRUCTION;
    }

    @Override
    public void setOpcode(final int aOpcode) {
        opcode = aOpcode;
    }

    @Override
    public int getOpcode() {
        return opcode;
    }

    @Override
    public void setLocalVariableIndex(final int aLocalVariableIndex) {
        localVariableIndex = aLocalVariableIndex;
    }

    @Override
    public int getLocalVariableIndex() {
        return localVariableIndex;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitVariableInstruction(this);
        return aBytecodeVisitor;
    }
}
